

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;


public class Demo5 {


    public static void main(String[] args) throws IOException {
        Demo5 demo3 = new Demo5();
        System.out.println("到课人员3");
        String[] s1 =demo3.demo();
        System.out.println(Arrays.toString(s1));
        System.out.println("应到名单3");
        String[] s2 = demo3.demo02();
        System.out.println(Arrays.toString(s2));
        System.out.println("未到名单");
        System.out.println(Arrays.toString(demo3.demo03(s1, s2)));

    }

    //到课人员
    public String[] demo() throws IOException {
        BufferedReader fr = new BufferedReader(new FileReader("E:\\到课人员3.txt"));//a.txt代表文件
        String line = null;
        String[] all = new String[10000];
        int i = 0;
        while ((line = fr.readLine()) != null) {
            String[] split = line.split("-");
            all[i] = split[0];
            i++;
        }
        String[] alls = Arrays.copyOf(all, i);
        return alls;
    }
    //应到名单
    public String[] demo02() throws IOException {
        BufferedReader fr = new BufferedReader(new FileReader("E:\\应到名单3.txt"));//a.txt代表文件
        String line = null;
        String[] all = new String[10000];
        int i = 0;
        while ((line = fr.readLine()) != null) {
            String[] split = line.split("-");
            all[i] = split[0];
            i++;
        }
        String[] alls = Arrays.copyOf(all, i);
        return alls;
    }
    //未到人员
    public String[] demo03(String[] s1,String[] s2){
        String[] s=new String[10000000];
        int c=0;
        for (int i = 0; i < s2.length; i++) {
            boolean b=true;
            for (int j = 0; j < s1.length; j++) {
                if (s2[i].equals(s1[j])){
                    b=false;
                    break;
                }

            }
            if(b){
                s[c]=s2[i];
                c++;
            }
        }
       return Arrays.copyOf(s,c);
    }


}